<%


%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META HTTP-EQUIV="pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate"> 
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 
<META HTTP-EQUIV="expires" CONTENT="0">
<meta name="viewport" content="height=device-height,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<link href="img/css/css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/demo.Default.css" />
<link href="css/jquery.multiSelect.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.popup{
	background-color: #1e1e1e;
	margin-right: auto;
	margin-left: auto;
	border: 1px solid #8d8d8d;
	width:80%;
	overflow:auto;
	position: absolute;
	z-index: 99;
	left:10%;
	top: 10%;
}
.white_bg{
	overflow: hidden;
	width: 100%;
	height: 100%;
	z-index: 9999;
	background-image: url(img/white_bg.png);
	background-repeat: repeat;
	position: absolute;
	top: 0;
	left: 0;
}
.list_group{
	height: 58px;
	width: 96%;
	padding-right: 2%;
	padding-left: 2%;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #c0c0c0;
	overflow: hidden;
}
.popup_list_area{
	height: 360px;
	width: 100%;
	overflow: auto;
}
.popup_btn_add{
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #8d8d8d;
	width:100%;
	height:40px;
	line-height: 40px;
	display:block;
	font-size: 15px;
}
.left_btn_popup_add, .right_btn_popup_add{
	width: 49%;
	height: 40px;
	float: left;
}
</style>
<script src="http://webapi.amap.com/maps?v=1.3&key=57c58c7b1f94514317df97e3a985962c"></script>
<script language="javascript" type="text/javascript" src="js/WdatePicker.js"></script>
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="js/QueryStringParser.js"></script>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script src="js/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="js/jquery.multiSelect.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.json.min.js"></script>  
<script type="text/javascript" src="js/jsonMsg.js"></script> 
		
<script language="javascript">
var mapObj;
var windowsArr = [];
var marker = [];
function mapInit() {
 
    mapObj = new AMap.Map("iCenter", {
        view: new AMap.View2D({
            zoom:13//地图显示的缩放级别
        }),
        keyboardEnable:false
    });
    mapObj.plugin(["AMap.ToolBar"],function(){		
			toolBar = new AMap.ToolBar();
			mapObj.addControl(toolBar);		
		});
	
	document.getElementById("keyword").onkeyup = keydown;
}

function inputTxt(txtValue) {

  var forbidChar = new Array("@", "#", "$", "^", "&", "*", "……", "￥", "\"", "’", "'");
  for (var i = 0; i < forbidChar.length; i++) {
      if (txtValue.indexOf(forbidChar[i]) >= 0) {
          alert("您输入的信息中含有非法字符: " + forbidChar[i] + " 请更正！");
          return true;
      }
  }
  return false;;
}

function getStrLength(strValue) {
  var strLength = strValue.length;
  for (var j = 0; j < strValue.length; j++) {
      if (strValue.charCodeAt(j) > 255) {
          strLength++;
      }
  }
  return strLength;
}

function strDateTime(str)
{
	var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
	var r = str.match(reg);
	if(r==null)return false;
	var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);
	return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);
}

var r = /^\+?[1-9][0-9]*$/;　　//正整数 

function validIntField(fieldName,displayName,fieldLength){
	var name = document.getElementById(fieldName).value; 
	if(name==null || name.trim()==""){
	alert("请输入"+displayName+".");
	document.getElementById(fieldName).select();
	return false;	
	}
	if(getStrLength(name)>fieldLength){
	alert(displayName+"长度不能超过"+fieldLength+".");
	document.getElementById(fieldName).select();
	return false;	
	}
	if(!r.test(name)){
	alert(displayName+"必须是整数.");
	document.getElementById(fieldName).select();
	return false;	
	}
	return true;
}

var f = /^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$/;
function validFloatField(fieldName,displayName,fieldLength){
	var name = document.getElementById(fieldName).value; 
	if(name==null || name.trim()==""){
	alert("请输入"+displayName+".");
	document.getElementById(fieldName).select();
	return false;	
	}
	if(getStrLength(name)>fieldLength){
	alert(displayName+"长度不能超过"+fieldLength+".");
	document.getElementById(fieldName).select();
	return false;	
	}
	if(isNaN(name)){
	alert(displayName+"必须是数字.");
	document.getElementById(fieldName).select();
	return false;	
	}
	return true;
}

function validField(fieldName,displayName,fieldLength){
	var name = document.getElementById(fieldName).value; 
	if(name==null || name.trim()==""){
		alert("请输入"+displayName+".");
		document.getElementById(fieldName).select();
		return false;	
	}
	if(getStrLength(name)>fieldLength){
		alert(displayName+"长度不能超过"+fieldLength+".");
		document.getElementById(fieldName).select();
		return false;	
	}	
	if(inputTxt(name)){
		document.getElementById(fieldName).select();
		return false;		
	}
	return true;	
}
 
//输入提示
function autoSearch() {
    var keywords = document.getElementById("keyword").value;
    var cityName = document.getElementById("city").value;
    if(cityName==null || cityName.trim()==""){
    	alert("请先输入城市!");
    	return false;	
    }
    var auto;
    //加载输入提示插件
        AMap.service(["AMap.Autocomplete"], function() {
        var autoOptions = {
            city: cityName //城市，默认全国
        };
        auto = new AMap.Autocomplete(autoOptions);
        //查询成功时返回查询结果
        if ( keywords.length > 0) {
            auto.search(keywords, function(status, result){
            	autocomplete_CallBack(result);
            });
        }
        else {
            document.getElementById("result1").style.display = "none";
        }
    });
}
 
//输出输入提示结果的回调函数
function autocomplete_CallBack(data) {
    var resultStr = "";
    var tipArr = data.tips;
    if (tipArr&&tipArr.length>0) {                 
        for (var i = 0; i < tipArr.length; i++) {
            resultStr += "<div id='divid" + (i + 1) + "' onmouseover='openMarkerTipById(" + (i + 1)
                        + ",this)' onclick='selectResult(" + i + ")' onmouseout='onmouseout_MarkerStyle(" + (i + 1)
                        + ",this)' style=\"font-size: 13px;cursor:pointer;padding:5px 5px 5px 5px;\"" + "data=" + tipArr[i].adcode + ">" + tipArr[i].name + "<span style='color:#C1C1C1;'>"+ tipArr[i].district + "</span></div>";
        }
    }
    else  {
        resultStr = " π__π 亲,人家找不到结果!<br />要不试试：<br />1.请确保所有字词拼写正确<br />2.尝试不同的关键字<br />3.尝试更宽泛的关键字";
    }
    document.getElementById("result1").curSelect = -1;
    document.getElementById("result1").tipArr = tipArr;
    document.getElementById("result1").innerHTML = resultStr;
    document.getElementById("result1").style.display = "block";
}
 
//输入提示框鼠标滑过时的样式
function openMarkerTipById(pointid, thiss) {  //根据id打开搜索结果点tip 
    thiss.style.background = '#CAE1FF';
}
 
//输入提示框鼠标移出时的样式
function onmouseout_MarkerStyle(pointid, thiss) {  //鼠标移开后点样式恢复 
    thiss.style.background = "";
}
 
//从输入提示框中选择关键字并查询
function selectResult(index) {
    if(index<0){
        return;
    }
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        document.getElementById("keyword").onpropertychange = null;
        document.getElementById("keyword").onfocus = focus_callback;
    }
    //截取输入提示的关键字部分
    var text = document.getElementById("divid" + (index + 1)).innerHTML.replace(/<[^>].*?>.*<\/[^>].*?>/g,"");
	var cityCode = document.getElementById("divid" + (index + 1)).getAttribute('data');
    document.getElementById("keyword").value = text;
    document.getElementById("result1").style.display = "none";
    //根据选择的输入提示关键字查询
    mapObj.plugin(["AMap.PlaceSearch"], function() {       
        var msearch = new AMap.PlaceSearch();  //构造地点查询类
        AMap.event.addListener(msearch, "complete", placeSearch_CallBack); //查询成功时的回调函数
		msearch.setCity(cityCode);
        msearch.search(text);  //关键字查询查询
    });
}
 
//定位选择输入提示关键字
function focus_callback() {
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        document.getElementById("keyword").onpropertychange = autoSearch;
   }
}
 
//输出关键字查询结果的回调函数
function placeSearch_CallBack(data) {
    //清空地图上的InfoWindow和Marker
    windowsArr = [];
    marker     = [];
    mapObj.clearMap();
    var resultStr1 = "";
    var poiArr = data.poiList.pois;
    var resultCount = poiArr.length;
    for (var i = 0; i < 1; i++) {
    	latLon = poiArr[i].location;
        resultStr1 += "<div id='divid" + (i + 1) + "' onmouseover='openMarkerTipById1(" + i + ",this)' onmouseout='onmouseout_MarkerStyle(" + (i + 1) + ",this)' style=\"font-size: 12px;cursor:pointer;padding:0px 0 4px 2px; border-bottom:1px solid #C1FFC1;\"><table><tr><td><img src=\"http://webapi.amap.com/images/" + (i + 1) + ".png\"></td>" + "<td><h3><font color=\"#00a6ac\">名称: " + poiArr[i].name + "</font></h3>";
            resultStr1 += TipContents(poiArr[i].type, poiArr[i].address, poiArr[i].tel) + "</td></tr></table></div>";
            addmarker(i, poiArr[i]);
    }
    //mapObj.setFitView();
    //document.getElementById("result").innerHTML = resultStr1;
    //document.getElementById("result").style.display = "block";
}
 
//鼠标滑过查询结果改变背景样式，根据id打开信息窗体
function openMarkerTipById1(pointid, thiss) {
    this.style.background = '#CAE1FF';
    windowsArr[pointid].open(mapObj, marker[pointid]);
}
 
//添加查询结果的marker&infowindow   
function addmarker(i, d) {
    var lngX = d.location.getLng();
    var latY = d.location.getLat();
    var markerOption = {
        map:mapObj,
        icon:"http://webapi.amap.com/images/" + (i + 1) + ".png",
        position:new AMap.LngLat(lngX, latY)
    };
    var mar = new AMap.Marker(markerOption);         
    marker.push(new AMap.LngLat(lngX, latY));
 
    var infoWindow = new AMap.InfoWindow({
        content:"<h3><font color=\"#00a6ac\">  " + (i + 1) + ". " + d.name + "</font></h3>" + TipContents(d.type, d.address, d.tel),
        size:new AMap.Size(300, 0),
        autoMove:true, 
        offset:new AMap.Pixel(0,-30)
    });
    mapObj.setZoomAndCenter(15, new AMap.LngLat(lngX,latY));
    windowsArr.push(infoWindow);
    var aa = function (e) {infoWindow.open(mapObj, mar.getPosition());};
    AMap.event.addListener(mar, "click", aa);
}
 
//infowindow显示内容
function TipContents(type, address, tel) {  //窗体内容
    if (type == "" || type == "undefined" || type == null || type == " undefined" || typeof type == "undefined") {
        type = "暂无";
    }
    if (address == "" || address == "undefined" || address == null || address == " undefined" || typeof address == "undefined") {
        address = "暂无";
    }
    if (tel == "" || tel == "undefined" || tel == null || tel == " undefined" || typeof address == "tel") {
        tel = "暂无";
    }
    var str = "  地址：" + address + "<br />  电话：" + tel + " <br />  类型：" + type;
    return str;
}
function keydown(event){
    var key = (event||window.event).keyCode;
    var result = document.getElementById("result1")
    var cur = result.curSelect;
    if(key===40){//down
        if(cur + 1 < result.childNodes.length){
            if(result.childNodes[cur]){
                result.childNodes[cur].style.background='';
            }
            result.curSelect=cur+1;
            result.childNodes[cur+1].style.background='#CAE1FF';
            document.getElementById("keyword").value = result.tipArr[cur+1].name;
        }
    }else if(key===38){//up
        if(cur-1>=0){
            if(result.childNodes[cur]){
                result.childNodes[cur].style.background='';
            }
            result.curSelect=cur-1;
            result.childNodes[cur-1].style.background='#CAE1FF';
            document.getElementById("keyword").value = result.tipArr[cur-1].name;
        }
    }else if(key === 13){
        var res = document.getElementById("result1");
		if(res && res['curSelect'] !== -1){
			selectResult(document.getElementById("result1").curSelect);
		}
    }else{
        autoSearch();
    }
}

function getPageSize() {

    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {

        xScroll = window.innerWidth + window.scrollMaxX;

        yScroll = window.innerHeight + window.scrollMaxY;

    } else {

        if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac    

            xScroll = document.body.scrollWidth;

            yScroll = document.body.scrollHeight;

        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari    

            xScroll = document.body.offsetWidth;

            yScroll = document.body.offsetHeight;

        }

    }

    var windowWidth, windowHeight;

    if (self.innerHeight) { // all except Explorer    

        if (document.documentElement.clientWidth) {

            windowWidth = document.documentElement.clientWidth;

        } else {

            windowWidth = self.innerWidth;

        }

        windowHeight = self.innerHeight;

    } else {

        if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode    

            windowWidth = document.documentElement.clientWidth;

            windowHeight = document.documentElement.clientHeight;

        } else {

            if (document.body) { // other Explorers    

                windowWidth = document.body.clientWidth;

                windowHeight = document.body.clientHeight;

            }

        }

    }       

    // for small pages with total height less then height of the viewport    

    if (yScroll < windowHeight) {

        pageHeight = windowHeight;

    } else {

        pageHeight = yScroll;

    }    

    // for small pages with total width less then width of the viewport    

    if (xScroll < windowWidth) {

        pageWidth = xScroll;

    } else {

        pageWidth = windowWidth;

    }

    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);

    return arrayPageSize;

}
</script>
<title>增加旅程</title>
</head>

<body onload="mapInit();">
<div class="check_bar">
     <font id="mines"></font>
     <p class="user_name ml10" id="nickname"></p>
     <a href="javascript:void(0);" onclick="createTrip();"><p class="check_btn"><i class="iconfont" style="cursor:pointer;">&#xe602;</i></p></a>
</div>
<div class="input_con mt10">
     <div class="input_title">旅途主题</div>
     <div class="input_form mt10"><input name="title" id="title" type="text" class="formstyle_small"/></div>
     <div class="input_group">
         <div class="input_group_left w50">
               <div class="input_title2 mt5">过期时间</div>
               <div class="input_form2 mt10">
                    <input name="validDate" id="validDate" readonly type="text" class="formstyle_small" onClick="WdatePicker({minDate:'%y-%M-#{%d}'})"/>
               </div>
         </div> 
         <div class="input_group_right w50">
               <div class="input_title2 mt5">好友列表</div>
               <div class="input_form2 mt10">
                    <!--select class="formstyle_small_select" id="friends" name="friends[]" multiple="multiple" size="5"><option value=""></option></select-->
                    <a href="javascript:void(0);" onclick="displayFriends()">
		                  <div class="formstyle_small">
		                       <p class="formleft">请点击选择好友</p>
		                       <p class="data_ico"><i class="iconfont">&#xe607;</i></p>
		                  </div>
	                  </a>
               </div>
         </div> 
     </div>
     <div class="input_group">
         <div class="input_group_left w50">
               <div class="input_title2 mt5">城市</div>
               <div class="input_form2 mt15"><input name="city" id="city" type="text" class="formstyle_small"/></div>
         </div>
         <div class="input_group_right w50">
               <div class="input_title2 mt5">目的地</div>
               <div class="input_form2 mt15"><input name="keyword" id="keyword" type="text" class="formstyle_small"/></div>
               <div id="result1" name="result1" style="overflow: auto; width: 44%;background: #000; border: 1px solid gray;display: none;z-index: 999;position: absolute;"></div>
         </div>
     </div>
</div>
<div id="iCenter" style="width:99%;height:150px;margin-top: 0px;"></div>
<script type="text/javascript">
	document.getElementById("iCenter").style.height=(getPageSize()[1]-64-271)+"px";
</script>
<div class="white_bg" id="popupMain" style="display: none;">
	<div class="popup" id="popup">
			<div class="popup_list_area" id="popup_list_area">
				<font id="popupMsg">
						<a href="#">
				    <div class="list_group">
				         <p class="fl"><img src="img/user_pic.png" class="user_pic"><span class="popup_list_text">张小艺</span></p>
				         <p class="fr mt25"><i class="iconfont yellow">&#xe603;</i></p>
				    </div>
				    </a>
				    <a href="#">
				    <div class="list_group">
				         <p class="fl"><img src="img/user_pic.png" class="user_pic"><span class="popup_list_text">张小艺</span></p>
				         <p class="fr mt25"><i class="iconfont gray">&#xe604;</i></p>
				    </div>
				    </a>
			  </font>
		  </div>
	    <div class="popup_btn_add">
	         <a href="javascript:void(0);" onclick="cancelPopDiv()"><div class="left_btn_popup_add"><p class="ico_group_popup"><i class="iconfont img">&#xe601;</i>取消</p></div></a>
	         <a href="javascript:void(0);" onclick="hiddenPopDiv()"><div class="right_btn_popup_add line_left"><p class="ico_group_popup"><i class="iconfont img">&#xe602;</i>确定</p></div></a>
	    </div>
	</div>
</div>

</body>
</html>
 
<script type="text/javascript">
var latLon = "";
var openId = queryString.getParam("openid");
function createTrip(){
	if(latLon == ""){
		alert("请先确定目的地！");
		return false;	
	}
	
	if(String(latLon).indexOf(",")<0){
		alert("请先确定目的地！");
		return false;	
	}
	
	if(!validField("title","旅途主题",30))
		return false;
		
	var validDate = document.getElementById("validDate").value; 
	if(validDate==null || validDate.trim()==""){
			alert("请选择过期时间.");
			document.getElementById("validDate").select();
			return false;	
	}

	if(!validField("city","城市",30))
		return false;
		
	if(!validField("keyword","目的地",50))
		return false;
		
	var loc = {
		Latitude: 29.579916,
		Longitude: 115.98905	
	};
	
	loc.Latitude = parseFloat(String(latLon).split(",")[1])*1000000;
  loc.Longitude = parseFloat(String(latLon).split(",")[0])*1000000;

	var destination = {
		Name: $("#keyword").val(),  
    City: $("#city").val(),
		Loc : loc
	};
	
				
	var members = openidArray;
	members.push(openId);

	//members.push($("#friends").val());

//	if ($('input[name=friends[]]:checked').length < 1) { 
//	} 
//	else { 
//		var v = ''; 
//		$('input[name=friends[]]:checked').each(function() {
//			 if (v != '') { v += ',' } v += $(this).val() 
//			 members.push($(this).val())
//		}); 
//	}   

	
	var dataStr = {   
        Title: $("#title").val(),  
        ValidDate: $("#validDate").val()+' 23:59:59',  
        Destination: destination,  
        MemberStatus:members
    };  
	
	
	var bodyStr = popBody('CreateTrip',dataStr);
	var request = popRequest('CreateTrip',openId,bodyStr);
	//调用了jquery.json 库  
	var encoded = $.toJSON( request );  
	var jsonStr = encoded;  
	
	$.ajax({  
    	url : actionStr,  
    	type : 'POST',  
    	data : jsonStr,  
    	dataType : 'json',  
    	contentType : 'application/json',  
    	success : function(data, status, xhr) {  
    		//Do Anything After get Return data  
            window.location.href="trip_leader.html?openid="+openId+"&tripid="+data.portalResp.Data.TripID;

    	},  
    	Error : function(xhr, error, exception) {  
    		    // handle the error.    
            alert(exception.toString());  
    	}  
	});  
}

function cancelPopDiv(){
	document.getElementById("popupMain").style.display="none";	
	openidArray = [];
	return false;	
}

function hiddenPopDiv(){
	document.getElementById("popupMain").style.display="none";	
	return false;	
}
var openidArray = [];

Array.prototype.indexOf = function(val) {
    for (var i = 0; i < this.length; i++) {
        if (this[i] == val) return i;
    }
    return -1;
};
Array.prototype.remove = function(val) {
    var index = this.indexOf(val);
    if (index > -1) {
        this.splice(index, 1);
    }
};
function switchSelect(openidin){
	//alert(openidArray.indexOf(openidin));
		if(openidArray.indexOf(openidin)==-1){
			openidArray.push(openidin);
			document.getElementById(openidin).innerHTML='<i class="iconfont yellow">&#xe603;</i>';
		}else{
			openidArray.remove(openidin);
			document.getElementById(openidin).innerHTML='<i class="iconfont gray">&#xe604;</i>';
		}
}

function displayFriends(){
	document.getElementById("popupMain").style.display="";	
	if(mnums<4){
			document.getElementById("popup_list_area").style.height=200+"px";
	}
//	document.getElementById("popup").style.height=(getPageSize()[1]-120)+"px";
//	if(mnums>=9){
//		document.getElementById("popup").style.height=(getPageSize()[1]-120)+"px";
//	}else{
//		document.getElementById("popup").style.height=((25*mnums)+90)+"px";
//	}
}
var mnums = 0;
$(document).ready(function(){
  	
	if(openId==null || openId==""){
		return false;	
	}else{
		var dataStr = {};	
		var bodyStr = popBody('ListFriends',dataStr);
		var request = popRequest('ListFriends',openId,bodyStr);
		//调用了jquery.json 库  
		var encoded = $.toJSON( request );  
		var jsonStr = encoded;  
		
		
		$.ajax({  
		url : actionStr,  
		type : 'POST',  
		data : jsonStr,  
		dataType : 'json',  
		contentType : 'application/json',  
		success : function(data, status, xhr) {  
		//         Do Anything After get Return data  
				var friendsList = "";
        $.each(data.portalResp.Data.Profiles, function(index){  
            //$("#friends").append("<option value='"+data.portalResp.Data.Profiles[index].OpenID+"'>"+data.portalResp.Data.Profiles[index].NickName+"</option>" ); 
	            friendsList+='<a href="javascript:void(0);" onclick="switchSelect(\''+data.portalResp.Data.Profiles[index].OpenID+'\')">';
	            friendsList+='<div class="list_group">';
			        friendsList+=' <p class="fl"><img src="'+data.portalResp.Data.Profiles[index].ImageURL+'" class="user_pic" height="46" width="46"><span class="popup_list_text">'+data.portalResp.Data.Profiles[index].NickName+'</span></p>';
			        friendsList+=' <p class="fr mt25"><font id="'+data.portalResp.Data.Profiles[index].OpenID+'"><i class="iconfont gray">&#xe604;</i></font></p>';
			    		friendsList+='</div>';
			    		friendsList+='</a>';
			    		mnums++;
        }); 
        
//        if(mnums<9){
//        		for(var i=0;i<(9-mnums);i++){
//        				friendsList+='<a href="javascript:void(0);">';
//		            friendsList+='<div class="list_group">';
//				        friendsList+=' <p class="fl">&nbsp;</p>';
//				        friendsList+=' <p class="fr mt25">&nbsp;</p>';
//				    		friendsList+='</div>';
//				    		friendsList+='</a>';
//        		}
//        }
   			$("#popupMsg").html(friendsList);
   			//$("#friends").multiSelect({ selectAllText: '选择全部',noneSelected:"请选择",oneOrMoreSelected: '*' });
   			
        dataStr = {
					OpenID: 	openId
				};	
				bodyStr = popBody('UserDetail',dataStr);
				request = popRequest('UserDetail',openId,bodyStr);
				//调用了jquery.json 库  
				encoded = $.toJSON( request );  
				jsonStr = encoded;  
		
				$.ajax({  
				url : actionStr,  
				type : 'POST',  
				data : jsonStr,  
				dataType : 'json',  
				contentType : 'application/json',  
				success : function(data, status, xhr) {  
				//         Do Anything After get Return data  
		        $("#mines").html("");	
						var imageURL = data.portalResp.Data.Profiles.ImageURL;
						if(imageURL.substring(imageURL.length-3)=="/64"){
          			imageURL = imageURL.substring(0,imageURL.length-3)+"/46";
          	}
						$("#mines").html("<img src='"+imageURL+"'  class='user_pic' height='46' width='46'>");	
						
						$("#nickname").html("");	
						$("#nickname").html(data.portalResp.Data.Profiles.NickName);	
		        
				},  
				Error : function(xhr, error, exception) {  
				    // handle the error.    
				    alert(exception.toString());  
				}  
				});  
		},  
		Error : function(xhr, error, exception) {  
		    // handle the error.    
		    alert(exception.toString());  
		}  
		});  
	}
	
});

</script>